package com.itheima.day06JDBC连接池JDBCTemplate.Demo1.meduird;

import com.itheima.jdbc.数据库MYSQL.util.JDBCUtil;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class DuirdDemo2 {
    public static void main(String[] args) {
        Connection conn = null;
        PreparedStatement pstmt = null;
        try {
            conn= JDBCUtil.getConnection();
            String sql="insert into account values(null,?,?)";
            pstmt=conn.prepareStatement(sql);
            pstmt.setString(1,"王五");
            pstmt.setDouble(2,3000);
            int i = pstmt.executeUpdate();
            System.out.println(i);
        } catch (SQLException e) {
            e.printStackTrace();
        }finally {
            JDBCUtil.colse(pstmt,conn);
        }

    }
}
